package com.hqyj.controller;

import com.hqyj.pojo.ResultVo;
import com.hqyj.pojo.UserInfo;
import com.hqyj.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Autor 伍军
 * @Date 2022/9/8 16:27
 * @Version 1.0
 **/
@RestController
@RequestMapping("/userInfo")
public class UserInfoController {

    //注入userService
    @Autowired
    UserInfoService userInfoService;

    //定义修改密码
    @GetMapping("/updatePwd")
    public ResultVo updatePwd(String email){
        return userInfoService.sendCode(email);
    }

    //验证验证码输入是否正确
    @PostMapping("/validateCode")
    public ResultVo validateCode(UserInfo userInfo){
        return userInfoService.validateCode(userInfo);
    }
    //修改密码
    @PostMapping("/updatePwd")
    public ResultVo updatePwd(UserInfo userInfo){
        return userInfoService.updatePwd(userInfo);
    }
    //发送短信
    @GetMapping("/sendSms")
    public ResultVo sendSms(String phone){
        return userInfoService.sendSms(phone);
    }

    //查询权限
    @GetMapping("/queryPowerByName")
    public ResultVo queryPowerByName(String userName){
        return userInfoService.queryPowerByName(userName);
    }
}
